package main

import (
	"database/sql"
	"github.com/pkg/errors"
	"log"
)

func main()  {
	e:=Control()
	if e != nil{
		log.Printf("original error:%v", errors.Cause(e))
		log.Printf("%+v",e)
	}
}

func Dao()error  {
	return sql.ErrNoRows
}

func Service() error {
	if e := Dao();e != nil{
		ne := errors.Wrap(e,"service error.")
		return ne
	}
	return nil
}

func Control() error {
	if e := Service();e != nil{
		//ne := errors.Wrap(e,"Control error.")
		return e
	}
	return nil
}